#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

#define DST "bckfqlajhemgiodnp"

void solve() {
	long long cnt = 0;
	char init[] = "bcadefghijklmnopq";
	do {
		if (!strcmp(init, DST)) {
			printf("%lld\n", cnt);
			return;
		}
	} while (next_permutation(init, init+17));
}

int main() {
	solve();
	return 0;
}
